﻿<%@ Page Language="C#" Culture="auto" UICulture="auto" MasterPageFile="~/MasterPages/ManagementMaster.master" AutoEventWireup="true"
  CodeBehind="Users.aspx.cs" Inherits="MONTRASEC_test.Management.Users" Title="MONTRASEC - Management - Users" %>
<!-- #include virtual="~/Multilingual.inc.aspx" -->
<asp:Content ID="Content1" ContentPlaceHolderID="cpHead" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="cpNavigation" runat="server">
  <ul class="clearfix">
    <li><a id="A1" href="~/Management/Default.aspx" runat="server">
      <asp:Label ID="Label1" runat="server" Text="<%$ Resources:Resource1, Management_Home %>"></asp:Label></a></li>
    <li><a id="A2" href="~/Management/Users.aspx" runat="server">
      <asp:Label ID="Label2" runat="server" Text="<%$ Resources:Resource1, Manage_Users %>"></asp:Label></a></li>
    <li><a id="A3" href="~/Management/Comments.aspx" runat="server">
      <asp:Label ID="Label3" runat="server" Text="<%$ Resources:Resource1, Manage_Comments %>"></asp:Label></a></li>
    <li><a id="A4" href="~/GroundLevel/Default.aspx" runat="server">
      <asp:Label ID="Label4" runat="server" Text="<%$ Resources:Resource1, Entities_Home %>"></asp:Label></a></li>
    <li><a id="A5" href="~/GroundLevel/A_NEWENTRY.aspx" runat="server">
      <asp:Label ID="Label5" runat="server" Text="<%$ Resources:Resource1, Manage_New_entries %>"></asp:Label></a></li>
    <li><a id="A6" href="~/GroundLevel/B_1_EVENTS.aspx" runat="server">
      <asp:Label ID="Label6" runat="server" Text="<%$ Resources:Resource1, Manage_B_1_Events %>"></asp:Label></a></li>
  </ul>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cpMainContent" runat="server">
  <asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
    <br />
      <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True"
        AutoGenerateColumns="False" 
        DataSourceID="sdsUsersEdit" PageSize="5">
      </asp:GridView>
      <asp:SqlDataSource ID="sdsUsersEdit" runat="server" 
        ConnectionString="<%$ ConnectionStrings:montrasecConnectionString %>" 
        DeleteCommand="DELETE FROM [USER_] WHERE [USER_USERNAME] = @original_USER_USERNAME" 
        InsertCommand="INSERT INTO [USER_] ([USER_FIRSTNAME], [USER_LASTNAME], [USER_COUNTRY], [USER_LEVEL], [USER_USERNAME], [USER_EMAIL]) VALUES (@USER_FIRSTNAME, @USER_LASTNAME, @USER_COUNTRY, @USER_LEVEL, @USER_USERNAME, @USER_EMAIL)" 
        OldValuesParameterFormatString="original_{0}" 
        SelectCommand="SELECT * FROM [USER_]" 
        
        UpdateCommand="UPDATE [USER_] SET [USER_FIRSTNAME] = @USER_FIRSTNAME, [USER_LASTNAME] = @USER_LASTNAME, [USER_COUNTRY] = @USER_COUNTRY, [USER_LEVEL] = @USER_LEVEL, [USER_EMAIL] = @USER_EMAIL WHERE [USER_USERNAME] = @original_USER_USERNAME">
        <DeleteParameters>
          <asp:Parameter Name="original_USER_USERNAME" Type="String" />
        </DeleteParameters>
        <UpdateParameters>
          <asp:Parameter Name="USER_FIRSTNAME" Type="String" />
          <asp:Parameter Name="USER_LASTNAME" Type="String" />
          <asp:Parameter Name="USER_COUNTRY" Type="String" />
          <asp:Parameter Name="USER_LEVEL" Type="String" />
          <asp:Parameter Name="USER_EMAIL" Type="String" />
          <asp:Parameter Name="original_USER_USERNAME" Type="String" />
        </UpdateParameters>
        <InsertParameters>
          <asp:Parameter Name="USER_FIRSTNAME" Type="String" />
          <asp:Parameter Name="USER_LASTNAME" Type="String" />
          <asp:Parameter Name="USER_COUNTRY" Type="String" />
          <asp:Parameter Name="USER_LEVEL" Type="String" />
          <asp:Parameter Name="USER_USERNAME" Type="String" />
          <asp:Parameter Name="USER_EMAIL" Type="String" />
        </InsertParameters>
      </asp:SqlDataSource>
      <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:montrasecConnectionString %>"
        SelectCommand="SELECT USER_.USER_FIRSTNAME, USER_.USER_LASTNAME, USER_.USER_COUNTRY, USER_.USER_LEVEL, USER_.USER_EMAIL FROM USER_ INNER JOIN USER_USER_LEVEL ON USER_.USER_LEVEL = USER_USER_LEVEL.EN"
        OldValuesParameterFormatString="original_{0}">
      </asp:SqlDataSource>
      <br />
      <asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" DataKeyNames="USER_EMAIL"
        DataSourceID="SqlDataSource1" DefaultMode="Insert" Height="50px" Width="125px">
        <Fields>
          <asp:BoundField DataField="USER_EMAIL" HeaderText="USER_EMAIL" ReadOnly="True" SortExpression="USER_EMAIL" />
          <asp:BoundField DataField="USER_FIRSTNAME" HeaderText="USER_FIRSTNAME" SortExpression="USER_FIRSTNAME" />
          <asp:BoundField DataField="USER_LASTNAME" HeaderText="USER_LASTNAME" SortExpression="USER_LASTNAME" />
          <asp:BoundField DataField="USER_COUNTRY" HeaderText="USER_COUNTRY" SortExpression="USER_COUNTRY" />
          <asp:BoundField DataField="USER_LEVEL" HeaderText="USER_LEVEL" SortExpression="USER_LEVEL" />
          <asp:CommandField />
        </Fields>
      </asp:DetailsView>
      <br />
    </ContentTemplate>
  </asp:UpdatePanel>
</asp:Content>
